﻿<UserControl x:Class="Rio.Framework.Pages.Controls.OCRThumbBox"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:Converter="clr-namespace:Rio.Framework.Pages.Helpers"
    mc:Ignorable="d"
    d:DesignHeight="300" d:DesignWidth="400">

    <UserControl.Resources>
        <Converter:ByteArrayToBitmapImageConverter x:Key="ByteArrayToBitmapImageConverter"/>
        
        <Style TargetType="ListBox" x:Key="DynamicCheckBoxStyle">
            <Setter Property="ItemTemplate">
                <Setter.Value>
                    <DataTemplate>
                        <CheckBox Content="{Binding Path=OcrMaskItem.Name}" IsChecked="{Binding IsChecked, Mode=TwoWay}" Checked="CheckBox_Checked" Unchecked="CheckBox_Unchecked"/>
                    </DataTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    </UserControl.Resources>

    <Border BorderBrush="Gray" BorderThickness="2" Background="LightGray">
        <StackPanel Name="LayoutRoot" Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="10">
            <TextBlock Name="NameVignette" HorizontalAlignment="Center" TextWrapping="Wrap" Text="{Binding Name}" FontWeight="Bold" FontSize="11" Margin="0,0,0,10"/>
            <Image Name="ImageVignette" Stretch="UniformToFill" Width="256" Height="256" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0,0,0,10" Source="{Binding Img, Converter={StaticResource ByteArrayToBitmapImageConverter}}"/>
            <CheckBox Name="CheckAll" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0,0,0,10"  Checked="CheckAll_Checked" Unchecked="CheckAll_Unchecked"/>
            <ScrollViewer Name="ScrollviewerCheckBox" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" VerticalAlignment="Center" HorizontalAlignment="Center" Width="256">
                <ListBox Name="DynamicCheckBox" Style="{StaticResource DynamicCheckBoxStyle}" VerticalAlignment="Center" HorizontalAlignment="Center" />
            </ScrollViewer>
        </StackPanel>
    </Border>
</UserControl>
